package com.aixin.project.servlet;

import com.aixin.project.data.AxSession;
import com.aixin.project.data.CommonConstants;
import com.aixin.project.util.RequestUtil;
import org.apache.velocity.Template;
import org.apache.velocity.context.Context;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class LogoutServlet extends BaseServlet {

    @Override
    protected Template execute(HttpServletRequest request, HttpServletResponse response, Context ctx) {
        RequestUtil.deleteCookie("u", response);
        request.getSession().removeAttribute(CommonConstants.USER_SESSION);
        this.sendRedirect(response, "/");
        return null;
    }

}
